Repository navigation
Generator: serve Map<T>() on the DbQuery types too - #280
Merged
Merged
Conversation
A plain `Map<T>()` on a `DbQuery`, a `DbQuery<TParams>`, a `DbQueryUsing` or a `DbQueryCall` now reads rows with a generated row reader, as it does on a command or a reader. These types declare `Map<T>()` themselves, and the generator only looked at the extension methods, so every query defined this way used the runtime map. No Core code changes. - Each interceptor calls the same type's existing `Map(RowMap<T>?)` with the model's generated map. The readonly structs are taken by `in`; the typed definition gets a generic interceptor that never names `TParams`, so a private parameter type or a type parameter of the caller works. - **Behavior change:** these calls no longer get the runtime map's conversions (see the generator's "Known differences"). `<OdxGenerateMaps>false</OdxGenerateMaps>` switches generation off, as before. - Generated output for a project with no such call is unchanged: the generator tests' output is byte-identical before and after on the unchanged test sources. - Tests compare each new receiver with its own runtime map and check that generated code served it, including from values, variables and an `in` parameter, with a private parameter type, inside a generic method, a default struct, and a single value (not intercepted). The package consumer tests use all four with the generator on, off and with C# 12. - Docs: the statements that a `DbQuery` is not generated are updated, `x?.Map<T>()` is listed as not intercepted, and the release notes record the change. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A plain
Map<T>()on aDbQuery, aDbQuery<TParams>, aDbQueryUsingor aDbQueryCallnow reads rows with a generated row reader, as it does on a command or a reader. These types declareMap<T>()themselves, and the generator only looked at the extension methods, so every query defined this way used the runtime map. No Core code changes.Map(RowMap<T>?)with the model's generated map. The readonly structs are taken byin; the typed definition gets a generic interceptor that never namesTParams, so a private parameter type or a type parameter of the caller works.<OdxGenerateMaps>false</OdxGenerateMaps>switches generation off, as before.inparameter, with a private parameter type, inside a generic method, a default struct, and a single value (not intercepted). The package consumer tests use all four with the generator on, off and with C# 12.DbQueryis not generated are updated,x?.Map<T>()is listed as not intercepted, and the release notes record the change.🤖 Generated with Claude Code